3.13.12 \(\int \frac {a+b \tan (e+f x)}{c+d \tan (e+f x)} \, dx\) [1212]

Optimal. Leaf size=59 \[ \frac {(a c+b d) x}{c^2+d^2}-\frac {(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right ) f} \]

[Out]

(a*c+b*d)*x/(c^2+d^2)-(-a*d+b*c)*ln(c*cos(f*x+e)+d*sin(f*x+e))/(c^2+d^2)/f

________________________________________________________________________________________

Rubi [A]
time = 0.05, antiderivative size = 59, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.087, Rules used = {3612, 3611} \begin {gather*} \frac {x (a c+b d)}{c^2+d^2}-\frac {(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

((a*c + b*d)*x)/(c^2 + d^2) - ((b*c - a*d)*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/((c^2 + d^2)*f)

Rule 3611

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c/(b*f))
*Log[RemoveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3612

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c +
b*d)*(x/(a^2 + b^2)), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rubi steps

\begin {align*} \int \frac {a+b \tan (e+f x)}{c+d \tan (e+f x)} \, dx &=\frac {(a c+b d) x}{c^2+d^2}-\frac {(b c-a d) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{c^2+d^2}\\ &=\frac {(a c+b d) x}{c^2+d^2}-\frac {(b c-a d) \log (c \cos (e+f x)+d \sin (e+f x))}{\left (c^2+d^2\right ) f}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.12, size = 65, normalized size = 1.10 \begin {gather*} \frac {2 (a c+b d) \text {ArcTan}(\tan (e+f x))+(b c-a d) \left (\log \left (\sec ^2(e+f x)\right )-2 \log (c+d \tan (e+f x))\right )}{2 \left (c^2+d^2\right ) f} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x])/(c + d*Tan[e + f*x]),x]

[Out]

(2*(a*c + b*d)*ArcTan[Tan[e + f*x]] + (b*c - a*d)*(Log[Sec[e + f*x]^2] - 2*Log[c + d*Tan[e + f*x]]))/(2*(c^2 +
 d^2)*f)

________________________________________________________________________________________

Maple [A]
time = 0.18, size = 82, normalized size = 1.39

method result size
derivativedivides \(\frac {\frac {\frac {\left (-a d +b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a c +b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (a d -b c \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(82\)
default \(\frac {\frac {\frac {\left (-a d +b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a c +b d \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (a d -b c \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{c^{2}+d^{2}}}{f}\) \(82\)
norman \(\frac {\left (a c +b d \right ) x}{c^{2}+d^{2}}+\frac {\left (a d -b c \right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{f \left (c^{2}+d^{2}\right )}-\frac {\left (a d -b c \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (c^{2}+d^{2}\right )}\) \(85\)
risch \(\frac {i x b}{i d -c}-\frac {a x}{i d -c}-\frac {2 i a d x}{c^{2}+d^{2}}+\frac {2 i b c x}{c^{2}+d^{2}}-\frac {2 i a d e}{f \left (c^{2}+d^{2}\right )}+\frac {2 i b c e}{f \left (c^{2}+d^{2}\right )}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a d}{f \left (c^{2}+d^{2}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) b c}{f \left (c^{2}+d^{2}\right )}\) \(186\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x,method=_RETURNVERBOSE)

[Out]

1/f*(1/(c^2+d^2)*(1/2*(-a*d+b*c)*ln(1+tan(f*x+e)^2)+(a*c+b*d)*arctan(tan(f*x+e)))+(a*d-b*c)/(c^2+d^2)*ln(c+d*t
an(f*x+e)))

________________________________________________________________________________________

Maxima [A]
time = 0.56, size = 91, normalized size = 1.54 \begin {gather*} \frac {\frac {2 \, {\left (a c + b d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} - \frac {2 \, {\left (b c - a d\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} + d^{2}} + \frac {{\left (b c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

1/2*(2*(a*c + b*d)*(f*x + e)/(c^2 + d^2) - 2*(b*c - a*d)*log(d*tan(f*x + e) + c)/(c^2 + d^2) + (b*c - a*d)*log
(tan(f*x + e)^2 + 1)/(c^2 + d^2))/f

________________________________________________________________________________________

Fricas [A]
time = 1.24, size = 79, normalized size = 1.34 \begin {gather*} \frac {2 \, {\left (a c + b d\right )} f x - {\left (b c - a d\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right )}{2 \, {\left (c^{2} + d^{2}\right )} f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

1/2*(2*(a*c + b*d)*f*x - (b*c - a*d)*log((d^2*tan(f*x + e)^2 + 2*c*d*tan(f*x + e) + c^2)/(tan(f*x + e)^2 + 1))
)/((c^2 + d^2)*f)

________________________________________________________________________________________

Sympy [C] Result contains complex when optimal does not.
time = 0.47, size = 524, normalized size = 8.88 \begin {gather*} \begin {cases} \frac {\tilde {\infty } x \left (a + b \tan {\left (e \right )}\right )}{\tan {\left (e \right )}} & \text {for}\: c = 0 \wedge d = 0 \wedge f = 0 \\\frac {i a f x \tan {\left (e + f x \right )}}{2 d f \tan {\left (e + f x \right )} - 2 i d f} + \frac {a f x}{2 d f \tan {\left (e + f x \right )} - 2 i d f} + \frac {i a}{2 d f \tan {\left (e + f x \right )} - 2 i d f} + \frac {b f x \tan {\left (e + f x \right )}}{2 d f \tan {\left (e + f x \right )} - 2 i d f} - \frac {i b f x}{2 d f \tan {\left (e + f x \right )} - 2 i d f} - \frac {b}{2 d f \tan {\left (e + f x \right )} - 2 i d f} & \text {for}\: c = - i d \\- \frac {i a f x \tan {\left (e + f x \right )}}{2 d f \tan {\left (e + f x \right )} + 2 i d f} + \frac {a f x}{2 d f \tan {\left (e + f x \right )} + 2 i d f} - \frac {i a}{2 d f \tan {\left (e + f x \right )} + 2 i d f} + \frac {b f x \tan {\left (e + f x \right )}}{2 d f \tan {\left (e + f x \right )} + 2 i d f} + \frac {i b f x}{2 d f \tan {\left (e + f x \right )} + 2 i d f} - \frac {b}{2 d f \tan {\left (e + f x \right )} + 2 i d f} & \text {for}\: c = i d \\\frac {x \left (a + b \tan {\left (e \right )}\right )}{c + d \tan {\left (e \right )}} & \text {for}\: f = 0 \\\frac {a x + \frac {b \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f}}{c} & \text {for}\: d = 0 \\\frac {2 a c f x}{2 c^{2} f + 2 d^{2} f} + \frac {2 a d \log {\left (\frac {c}{d} + \tan {\left (e + f x \right )} \right )}}{2 c^{2} f + 2 d^{2} f} - \frac {a d \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c^{2} f + 2 d^{2} f} - \frac {2 b c \log {\left (\frac {c}{d} + \tan {\left (e + f x \right )} \right )}}{2 c^{2} f + 2 d^{2} f} + \frac {b c \log {\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 c^{2} f + 2 d^{2} f} + \frac {2 b d f x}{2 c^{2} f + 2 d^{2} f} & \text {otherwise} \end {cases} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

Piecewise((zoo*x*(a + b*tan(e))/tan(e), Eq(c, 0) & Eq(d, 0) & Eq(f, 0)), (I*a*f*x*tan(e + f*x)/(2*d*f*tan(e +
f*x) - 2*I*d*f) + a*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) + I*a/(2*d*f*tan(e + f*x) - 2*I*d*f) + b*f*x*tan(e + f*
x)/(2*d*f*tan(e + f*x) - 2*I*d*f) - I*b*f*x/(2*d*f*tan(e + f*x) - 2*I*d*f) - b/(2*d*f*tan(e + f*x) - 2*I*d*f),
 Eq(c, -I*d)), (-I*a*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + a*f*x/(2*d*f*tan(e + f*x) + 2*I*d*f) -
I*a/(2*d*f*tan(e + f*x) + 2*I*d*f) + b*f*x*tan(e + f*x)/(2*d*f*tan(e + f*x) + 2*I*d*f) + I*b*f*x/(2*d*f*tan(e
+ f*x) + 2*I*d*f) - b/(2*d*f*tan(e + f*x) + 2*I*d*f), Eq(c, I*d)), (x*(a + b*tan(e))/(c + d*tan(e)), Eq(f, 0))
, ((a*x + b*log(tan(e + f*x)**2 + 1)/(2*f))/c, Eq(d, 0)), (2*a*c*f*x/(2*c**2*f + 2*d**2*f) + 2*a*d*log(c/d + t
an(e + f*x))/(2*c**2*f + 2*d**2*f) - a*d*log(tan(e + f*x)**2 + 1)/(2*c**2*f + 2*d**2*f) - 2*b*c*log(c/d + tan(
e + f*x))/(2*c**2*f + 2*d**2*f) + b*c*log(tan(e + f*x)**2 + 1)/(2*c**2*f + 2*d**2*f) + 2*b*d*f*x/(2*c**2*f + 2
*d**2*f), True))

________________________________________________________________________________________

Giac [A]
time = 0.47, size = 97, normalized size = 1.64 \begin {gather*} \frac {\frac {2 \, {\left (a c + b d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {{\left (b c - a d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} - \frac {2 \, {\left (b c d - a d^{2}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d + d^{3}}}{2 \, f} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

1/2*(2*(a*c + b*d)*(f*x + e)/(c^2 + d^2) + (b*c - a*d)*log(tan(f*x + e)^2 + 1)/(c^2 + d^2) - 2*(b*c*d - a*d^2)
*log(abs(d*tan(f*x + e) + c))/(c^2*d + d^3))/f

________________________________________________________________________________________

Mupad [B]
time = 5.49, size = 93, normalized size = 1.58 \begin {gather*} \frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a\,d-b\,c\right )}{f\,\left (c^2+d^2\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (-b+a\,1{}\mathrm {i}\right )}{2\,f\,\left (c+d\,1{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a-b\,1{}\mathrm {i}\right )}{2\,f\,\left (d+c\,1{}\mathrm {i}\right )} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a + b*tan(e + f*x))/(c + d*tan(e + f*x)),x)

[Out]

(log(c + d*tan(e + f*x))*(a*d - b*c))/(f*(c^2 + d^2)) - (log(tan(e + f*x) - 1i)*(a*1i - b))/(2*f*(c + d*1i)) -
 (log(tan(e + f*x) + 1i)*(a - b*1i))/(2*f*(c*1i + d))

________________________________________________________________________________________